package com.LeeCode;

/**
 * 找到初始输入字符串 I
 */

public class Code3330 {
    public static void main(String[] args) {
        String word = "abcd";
        System.out.println(new Code3330().possibleStringCount(word));
    }

    public int possibleStringCount(String word) {
        int ans = 1, count = 0;
        char[] chars = word.toCharArray();
        for (int i = 0; i < chars.length; i++) {
            count++;
            if (i == chars.length - 1 || chars[i] != chars[i + 1]) {
                ans += count - 1;
                count = 0;
            }
        }
        return ans;
    }
}
